//
//  BaseDefines.h
//  Project
//
//  Created by Suny on 14-8-7.
//  Copyright (c) 2014年 Suny. All rights reserved.
//
#import "BaseType.h"

#pragma -mark APP Default value
#undef  kPlatform
#define kPlatform     @"IOS"

#undef  kChannelId
#define kChannelId    @"AppStore"

#undef  kAppVersion
#define kAppVersion   [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]

#undef  kAppSignIdentifier
#define kAppSignIdentifier [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]
#undef  kAppBundleDisplayName
#define kAppBundleDisplayName [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]

#pragma -mark
#pragma -mark SYSTEM

// 系统版本号枚举
#define IOS_2_0 @"2.0"
#define IOS_3_0 @"3.0"
#define IOS_4_0 @"4.0"
#define IOS_5_0 @"5.0"
#define IOS_6_0 @"6.0"
#define IOS_7_0 @"7.0"


#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) \
([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
// >
#define SYSTEM_VERSION_GREATER_THAN(v) \
([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
// ==
#define SYSTEM_VERSION_EQUAL_TO(v) \
([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)


#pragma -mark
#pragma -mark DEVICE

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define Simulator ([[[UIDevice currentDevice] name] hasSuffix:@"Simulator"] ? YES : NO)

#pragma -mark
#pragma -mark UI

#define kDefaultNavigationDelY       (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(IOS_7_0)?10:0)
#define kDefaultStatusBarHeight      20
#define kDefaultToolbarHeight        44

#define kDefaultNavigationBarHeight  (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(IOS_7_0)?(44.0f+kDefaultStatusBarHeight):(44.0f))

#define kNavigationItemAlignment_HL_VC 10001
#define kNavigationItemAlignment_HR_VC 10002
#define kNavigationItemAlignment_HC_VC 10003

#pragma -mark
#pragma -mark TEXT

#undef   kHandleDataDefaultMessage
#define  kHandleDataDefaultMessage @"请稍后..."

#undef   kHandleDataCompleteDefaultMessage
#define  kHandleDataCompleteDefaultMessage @"数据处理完成！"

#undef   kInternetConnectionError
#define  kInternetConnectionError @"网络连接不通,请检查网络!"

#pragma -mark
#pragma -mark METHOD

#define NO_UNUSED_WARING(__OBJECT) (void)(__OBJECT)


#pragma -mark
#pragma -mark CHECK TYPE


#define CHECK_VALID_STRING(__string)               (__string && [__string isKindOfClass:[NSString class]] && [__string length])

#define CHECK_VALID_STRING_AND_RETURN(__string) CHECK_VALID_STRING(__string)?__string:@""

#define CHECK_VALID_NUMBER(__aNumber)               (__aNumber && [__aNumber isKindOfClass:[NSNumber class]])
#define CHECK_VALID_ARRAY(__aArray)                 (__aArray && [__aArray isKindOfClass:[NSArray class]] && [__aArray count])
#define CHECK_VALID_DICTIONARY(__aDictionary)       (__aDictionary && [__aDictionary isKindOfClass:[NSDictionary class]] && [__aDictionary count])
